package org.backend.repository;

import org.backend.pojo.entity.Cart;
import org.backend.mapper.CartMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class CartRepository {
    @Autowired
    private CartMapper cartMapper;

    public List<Cart> getUserCart(int id) {
        return cartMapper.getUserCart(id);
    }

    public int add(Cart cart) {
        return cartMapper.add(cart);
    }

    public int remove(Cart cart) {
        return cartMapper.remove(cart);
    }

    public List<Cart> getUserCartByOpenId(String openid) {
        return cartMapper.getUserCartByOpenId(openid);
    }

    public int addProduct(Cart cart) {
        return cartMapper.addProduct(cart);
    }

    public int subProduct(Cart cart) {
        return cartMapper.subProduct(cart);
    }
}
